<?php
namespace app\api\validate;

use think\Db;
use think\Validate;

/**
 * Class DeviceValidate
 * @package app\api\validate
 * @author zhenHong~
 * device设备验证类
 */
class DeviceValidate extends Validate{

    protected $rule = [
        'device_id' => ['require'],
        'operate' => ['require'], 
        'msgid' => ['require'], 
        'device_type' => ['require'],
        'device_iot_id'=> ['require'],
        'device_iot_secret'=> ['require'],
        'product_iot_id' => ['require'],
        'lat' => ['require'],
        'lon' => ['require'],
        'title' => ['require'],
        'pagenum' => ['number'],
        'id' => ['require'],
        'c_id' => ['require','number']
    ];

    protected $message = [
        'device_id' => '设备真实id',
        'operate' => '操作类型不能为空！', 
        'msgid' => '未获取到操作结果合法id',     
        'device_type' => '请指定设备类型',
        'device_iot_id'=> '请指定iot设备id',
        'device_iot_secret'=> '请指定iot设备secret',
        'product_iot_id' => '请指定产品id',
        'lat' => '未获取到纬度',
        'lon' => '未获取到经度',
        'title' => '请输入设备点名称',
        'pagenum' => '分页需要时数字',
        'c_id' => '未指定所属商户',
        'id' => '请指定查询主体'
    ];

    protected $scene = [
        'deviceInfo' => ['id'],
        'delDevice' => ['id'],
        'editCoupon' => ['device_id','lat','lon','title','id','address'],
        'addDevice' => ['device_id','lat','lon','title','c_id','address'],
        'deviceList' => ['pagenum'],
        'playDevice' => ['device_id','operate','product_iot_id'],
        'putStatus' => ['device_id','product_iot_id'],
        'mnstest' => ['msgid']
    ];
}